<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:cc="http://java.sun.com/jsf/composite">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="formName"/>
        <cc:attribute name="pagination" type="vn.com.aptech.msh.utils.PaginationHelper"/>
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <div class="wp-pagenavi">
            <span class="pages">Page #{cc.attrs.pagination.currentPage} of #{cc.attrs.pagination.maxPage}</span>
            <p:commandLink title="&laquo; First" value="&laquo; First" styleClass="first"
                           action="#{cc.attrs.pagination.firstPage}" oncomplete="pagi()" update="#{cc.attrs.formName}"/>

            <span class="extend">...</span>
            <p:commandLink title="&laquo;" value="&laquo;" action="#{cc.attrs.pagination.previousPage}"
                           oncomplete="pagi()" update="#{cc.attrs.formName}"/>

            <ui:repeat value="#{cc.attrs.pagination.pagesCenter}" var="page">
                <h:outputText rendered="#{page eq cc.attrs.pagination.currentPage}">
                    <span class="current">#{cc.attrs.pagination.currentPage}</span>
                </h:outputText>

                <p:commandLink title="#{page}" value="#{page}" action="#{cc.attrs.pagination.gotoPage(page)}"
                               oncomplete="pagi()" update="#{cc.attrs.formName}" rendered="#{page ne cc.attrs.pagination.currentPage}"/>
            </ui:repeat>

            <p:commandLink title="&raquo;" value="&raquo;" action="#{cc.attrs.pagination.nextPage}"
                           oncomplete="pagi()" update="#{cc.attrs.formName}"/>
            <span class="extend">...</span>

            <p:commandLink title="Last &raquo;" value="Last &raquo;" styleClass="last"
                           action="#{cc.attrs.pagination.lastPage}" oncomplete="pagi()" update="#{cc.attrs.formName}"/>
        </div>
    </cc:implementation>
</html>